<?php 
namespace app\api\model\traits;

use app\api\model\Category;
use app\api\model\GoodsImg;
use app\api\model\Goods;

Trait GoodsTrait{

	// 商品关联分类
	public function category()
	{
		return $this->hasOne(Category::class,'id','category_id');
	}
	// 商品关联相册
	public function goodsImg()
	{
		return $this->hasMany(GoodsImg::class);
	}

	public function goods(){
		return $this->hasOne(Goods::class,'id','goods_id');
	}
}

?>